from django.db import models

# Create your models here.
class UserModel(models.Model):
    username = models.CharField(max_length=20,unique=True,verbose_name='用户名')
    password = models.CharField(max_length=32,verbose_name='密码')
    email = models.EmailField(unique=True,verbose_name='邮箱')
    phone = models.CharField(max_length=11,unique=True,verbose_name='手机号')
    headimg = models.CharField(max_length=255,blank=True,null=True,verbose_name='头像',default='http://127.0.0.1:8000/uploads/toxiang/1.jpg')
    intro = models.CharField(max_length=255,blank=True,null=True,verbose_name='个人简介')
    level = models.IntegerField(default=0,choices=((0,'普通用户'),(1,'银牌用户'),(2,'金牌用户')),verbose_name='用户等级')
    class Meta:
        db_table = 'dxuser'
    def __str__(self):
        return self.username

class UserImg(models.Model):
    user = models.ForeignKey(UserModel,on_delete=models.CASCADE,verbose_name='用户')
    create_time = models.DateTimeField(auto_now_add=True,verbose_name='创建时间')
    class Meta:
        db_table = 'dxuserimg'




